﻿function GetNowDate(obj) {
//    var date = new Date();
//    var vMonth = ((date.getMonth() + 1).toString().length) == 1 ? "0" + (date.getMonth() + 1) : (date.getMonth() + 1);
//    var vDate = date.getDate().toString().length == 1 ? "0" + date.getDate() : date.getDate();
//        var vNow2 = date.getFullYear() + "-" + vMonth + "-" + vDate;
    var vNow ="";
    var url = DBCenterServiceUrl + "/WLMQ_OpinionModel/WLMQ_OpinionModel.asmx/GetDatetime";
    var param = "{'a':0 }";
    GetSmJSON(url, param, function (json) {
       this.vNow= json;
   });


    var vDate = $(obj).val();
    if (($(obj) != null && $(obj) != undefined && $(obj).val() == "") || vDate.indexOf("1970") >= 0) {
        $(obj).val(this.vNow);
    }
}

function GiveCurrentUserName(obj) {
    var m_user = new SmWFStaff();
    m_user.GetCurrentUser();
    if (obj != null && obj.val() == "" && m_user != null && m_user.StaffName != null) {
        obj.val(m_user.StaffName);
    }
}
function GiveCurrentUserName2(name, obj) {
    if (obj != null && obj.val() == "" && name != null) {
        obj.val(name);
    }
}

function ChangePrintType(alias, tablename, project_id, PrintCredentials, funOption) {
    var data = "{'strAlias':'" + alias + "','strTableName':'" + tablename + "','Project_id':'" + project_id + "','strPrintCredentials':'" + PrintCredentials + "'}";
    GetSmJSON(DBCenterServiceUrl + "/Core.asmx/ChangePrintType", data, funOption);
}